[IA64] vti fault handler clean up: make VTI_DEBUG configurable
authorAlex Williamson <alex.williamson@hp.com>
Fri, 14 Dec 2007 20:09:02 +0000 (13:09 -0700)
committerAlex Williamson <alex.williamson@hp.com>
Fri, 14 Dec 2007 20:09:02 +0000 (13:09 -0700)
And make IVT_DEBUG_MAX changable.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/arch/ia64/Rules.mk
xen/arch/ia64/asm-offsets.c
xen/arch/ia64/vmx/vmx_ivt.S
xen/arch/ia64/vmx/vmx_vcpu.c
xen/include/asm-ia64/vmx_vpd.h

index 7f9ade7930a94d62aba190531c5e5362b401e0db..860435b2a44bfe6021b2b1e8416ed6dca62b5066 100644 (file)
@@ -6,6 +6,7 @@ HAS_ACPI := y
 HAS_VGA  := y
 xenoprof := y
 no_warns ?= n
+vti_debug ?= n
 xen_ia64_expose_p2m    ?= y
 xen_ia64_pervcpu_vhpt  ?= y
 xen_ia64_tlb_track     ?= y
@@ -36,7 +37,9 @@ CFLAGS        += $(CPPFLAGS)
 CFLAGS += -DIA64 -DXEN -DLINUX_2_6
 CFLAGS += -ffixed-r13 -mfixed-range=f2-f5,f12-f127,b2-b5
 CFLAGS += -g
-#CFLAGS  += -DVTI_DEBUG
+ifeq ($(vti_debug),y)
+CFLAGS  += -DVTI_DEBUG
+endif
 ifeq ($(xen_ia64_expose_p2m),y)
 CFLAGS += -DCONFIG_XEN_IA64_EXPOSE_P2M
 endif
index 543c36ed12e67145586addf032e3f267cc9242a1..1566d93b4b02b797e48177d4f19cdda231bee0bb 100644 (file)
@@ -46,6 +46,7 @@ void foo(void)
 #ifdef   VTI_DEBUG
        DEFINE(IVT_CUR_OFS, offsetof(struct vcpu, arch.arch_vmx.ivt_current));
        DEFINE(IVT_DBG_OFS, offsetof(struct vcpu, arch.arch_vmx.ivt_debug));
+       DEFINE(IVT_DEBUG_SIZE, sizeof(struct ivt_debug));
 #endif
        DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
        DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
index 714287a49bc77857e9e4c120e7f53d242f149afb..8b6cf59e9270db8a382cc1312a1dab6faf231f3a 100644 (file)
@@ -70,6 +70,7 @@
 
 
 #ifdef VTI_DEBUG
+#define IVT_DEBUG_MASK  (IVT_DEBUG_SIZE * (IVT_DEBUG_MAX - 1))
 #define VMX_DBG_FAULT(i)                \
     add r16=IVT_CUR_OFS,r21;            \
     add r17=IVT_DBG_OFS,r21;;           \
@@ -80,9 +81,9 @@
     mov r22=cr.ifa;                     \
     mov r23=i;;                         \
     st8 [r17]=r19,8;                    \
-    add r18=32,r18;;                    \
+    add r18=IVT_DEBUG_SIZE,r18;;        \
     st8 [r17]=r20,8;                    \
-    mov r19=0xfe0;;                     \
+    mov r19=IVT_DEBUG_MASK;;            \
     st8 [r17]=r22,8;                    \
     and r18=r19,r18;;                   \
     st8 [r17]=r23;                      \
index 6df63e7d6f4b97145963b83b1310c1c2d9ad65aa..fbb97bfe9cdccde4f668c5f71bfe2c0e883948f4 100644 (file)
@@ -111,13 +111,10 @@ vmx_vcpu_set_psr(VCPU *vcpu, unsigned long value)
     }
     new_psr.val=VCPU(vcpu, vpsr);
 #ifdef VTI_DEBUG    
-    {
-    struct pt_regs *regs = vcpu_regs(vcpu);
     guest_psr_buf[guest_psr_index].ip = regs->cr_iip;
     guest_psr_buf[guest_psr_index].psr = new_psr.val;
     if (++guest_psr_index >= 100)
         guest_psr_index = 0;
-    }
 #endif    
 #if 0
     if (old_psr.i != new_psr.i) {
index c351f3f702789e34ed7ecf2e17e5306ffd710685..d69bd96e8990bda8f10c4aa9fe2904c0315caeaf 100644 (file)
 #ifndef _ASM_IA64_VMX_VPD_H_
 #define _ASM_IA64_VMX_VPD_H_
 
+#ifdef VTI_DEBUG
+/*
+ * must be power of 2.
+ * Be carefull to avoid stack over flow keeping
+ * struct arch_vmx_struct(i.e. struct vcpu) small enough.
+ * sizeof(struct ivt_debug) * IVT_DEBUG_MAX = 32 * IVT_DEBUG_MAX
+ */
+//#define IVT_DEBUG_MAX 128     /* 4096 bytes */
+#define IVT_DEBUG_MAX 16        /*  512 bytes */
+#endif
+
 #ifndef __ASSEMBLY__
 
 #include <asm/vtm.h>
@@ -39,7 +50,6 @@ struct ivt_debug{
     unsigned long ifa;
     unsigned long vector;
 };
-#define IVT_DEBUG_MAX 128
 #endif
 
 struct arch_vmx_struct {